package sy.model.base;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Entity
@Table(name = "tuser", catalog = "")
public class Tuser implements java.io.Serializable {

	private String id;
	private Tcompany tcompany;
	private Integer age;
	private Date created;
	private String email;
	private String name;
	private String pwd;
	private Integer sex;
	private boolean systemdata;
	private Date updated;
	private Set<TuserTorganization> tuserTorganizations = new HashSet<TuserTorganization>(0);
	private Set<TuserTrole> tuserTroles = new HashSet<TuserTrole>(0);

	public Tuser() {
	}

	public Tuser(String id, Date created, String name, String pwd, boolean systemdata, Date updated) {
		this.id = id;
		this.created = created;
		this.name = name;
		this.pwd = pwd;
		this.systemdata = systemdata;
		this.updated = updated;
	}

	public Tuser(String id, Tcompany tcompany, Integer age, Date created, String email, String name, String pwd, Integer sex, boolean systemdata, Date updated, Set<TuserTorganization> tuserTorganizations, Set<TuserTrole> tuserTroles) {
		this.id = id;
		this.tcompany = tcompany;
		this.age = age;
		this.created = created;
		this.email = email;
		this.name = name;
		this.pwd = pwd;
		this.sex = sex;
		this.systemdata = systemdata;
		this.updated = updated;
		this.tuserTorganizations = tuserTorganizations;
		this.tuserTroles = tuserTroles;
	}

	@Id
	@Column(name = "id", unique = true, nullable = false, length = 36)
	public String getId() {
		return this.id;
	}

	public void setId(String id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "tcompany_id")
	public Tcompany getTcompany() {
		return this.tcompany;
	}

	public void setTcompany(Tcompany tcompany) {
		this.tcompany = tcompany;
	}

	@Column(name = "age")
	public Integer getAge() {
		return this.age;
	}

	public void setAge(Integer age) {
		this.age = age;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "created", nullable = false, length = 19)
	public Date getCreated() {
		return this.created;
	}

	public void setCreated(Date created) {
		this.created = created;
	}

	@Column(name = "email", length = 100)
	public String getEmail() {
		return this.email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	@Column(name = "name", nullable = false, length = 100)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "pwd", nullable = false, length = 100)
	public String getPwd() {
		return this.pwd;
	}

	public void setPwd(String pwd) {
		this.pwd = pwd;
	}

	@Column(name = "sex")
	public Integer getSex() {
		return this.sex;
	}

	public void setSex(Integer sex) {
		this.sex = sex;
	}

	@Column(name = "systemdata", nullable = false)
	public boolean isSystemdata() {
		return this.systemdata;
	}

	public void setSystemdata(boolean systemdata) {
		this.systemdata = systemdata;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "updated", nullable = false, length = 19)
	public Date getUpdated() {
		return this.updated;
	}

	public void setUpdated(Date updated) {
		this.updated = updated;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "tuser")
	public Set<TuserTorganization> getTuserTorganizations() {
		return this.tuserTorganizations;
	}

	public void setTuserTorganizations(Set<TuserTorganization> tuserTorganizations) {
		this.tuserTorganizations = tuserTorganizations;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "tuser")
	public Set<TuserTrole> getTuserTroles() {
		return this.tuserTroles;
	}

	public void setTuserTroles(Set<TuserTrole> tuserTroles) {
		this.tuserTroles = tuserTroles;
	}

}
